package com.supermarket.seefood51.api

import com.example.http.api.BaseApi
import com.example.http.listener.HttpOnNextListener
import com.supermarket.seefood51.BASE_URL
import com.supermarket.seefood51.base.BaseModel
import com.supermarket.seefood51.entity.UserEntity
import com.supermarket.seefood51.service.HttpService
import com.trello.rxlifecycle.components.support.RxAppCompatActivity
import retrofit2.Retrofit
import rx.Observable

class LoginApi(rxAppCompatActivity: RxAppCompatActivity, private val name: String, private val pwd: String,
               private val deviceId:String, listener: HttpOnNextListener<UserEntity>) :
        BaseApi<UserEntity>(rxAppCompatActivity, listener, BASE_URL) {

    //提供请求所需字段的数据
    override fun getObservable(retrofit: Retrofit): Observable<*> {

        val service = retrofit.create<HttpService>(HttpService::class.java)
        return service.login(name,pwd,deviceId)//传数据到HttpService
    }
}
